package Box2D.Dynamics
{
	import Box2D.Collision.Shapes.b2CircleShape;
	import Box2D.Collision.Shapes.b2EdgeShape;
	import Box2D.Collision.Shapes.b2MassData;
	import Box2D.Collision.Shapes.b2PolygonShape;
	import Box2D.Collision.Shapes.b2Shape;
	import Box2D.Common.Math.b2Vec2;
	import Box2D.Common.b2Wrapper;
	
	public class b2Fixture extends b2Wrapper
	{
		private var _userData:*;
		public function b2Fixture()
		{
			super();
		}
		public function GetType():int{
			return call('b2Fixture_GetType')
		}
		public function GetShape():b2Shape{
			var wrapper:Object = call('b2Fixture_GetShape');
			var cls:Class;
			switch(b2Shape.GetType(wrapper)){
				case b2Shape.e_circle:
					cls = b2CircleShape;
					break;
				case b2Shape.e_polygon:
					cls = b2PolygonShape;
					break;
				case b2Shape.e_edge:
					cls = b2EdgeShape;
					break;
			}
			return new cls(wrapper);
		}
		public function SetSensor(sensor:Boolean):void{
			call('b2Fixture_SetSensor',sensor);
		}
		public function IsSensor():Boolean{
			return call('b2Fixture_IsSensor');
		}
		public function SetFilterData(filter:b2Filter):void{
			call('b2Fixture_SetFilterData',filter.wrapper);
		}
		public function GetFilterData():b2Filter{
			return new b2Filter(call('b2Fixture_GetFilterData'));
		}
		public function GetBody():b2Body{
			return call('b2Fixture_GetBody');
		}
		public function GetNext():b2Fixture{
			return call('b2Fixture_GetNext');
		}
		public function GetUserData():*{return _userData}
		public function SetUserData(value:*):void{_userData=value}
		public function TestPoint(p:b2Vec2):Boolean{
			return call('b2Fixture_TestPoint',p.wrapper);
		}
		public function GetMassData(massData:b2MassData):void{
			call('b2Fixture_GetMassData',massData.wrapper);
		}
		public function SetDensity(density:Number):void{
			call('b2Fixture_SetDensity',density);
		}
		public function GetDensity():Number{
			return call('b2Fixture_GetDensity');
		}
		public function GetFriction():Number{
			return call('b2Fixture_GetFriction');			
		}
		public function SetFriction(friction:Number):void{
			call('b2Fixture_SetFriction',friction);
		}
		public function GetRestitution():Number{
			return call('b2Fixture_GetRestitution');			
		}
		public function SetRestitution(restitution:Number):void{
			call('b2Fixture_SetRestitution',restitution);
		}
	}
}